class Event{
    constructor(){
        this.events={}
    }
    on(eventName,callback){
        if(!this.events[eventName]){
            this.events[eventName]=[];
        }
        this.events[eventName].push(callback)
        return this;
    }
    once(eventName,callback){
        const wrapper=(...args)=>{
            callback(...args);
            this.off(eventName,wrapper)
        }
        this.on(eventName,wrapper);
        return this;
    }

    off(eventName,callback){
        if(!this.events[eventName]){
            return this;
        }
        this.events[eventName]=this.events[eventName].filter(cb=>cb!==callback)
        return this;
    }
    emit(){

    }
}

